﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataStuctureStudy
{
    static class ArrangeStudy
    {
        public static void Arrange(char[] items)
        {
            Arrange(items, 0);
        }

        private static void Arrange(char[] items, int startIndex)
        {
            if (startIndex == items.Length - 1)
            {
                Console.WriteLine(String.Join(",", items));
            }

            for (var i = startIndex; i < items.Length; i++)
            {
                Arrange(items, startIndex + 1);
                Rolate(items, startIndex);
            }
        }

        private static void Rolate(char[] items, int startIndex)
        {
            var temp = items[startIndex];
            for (int i = startIndex; i < items.Length - 1; i++)
            {
                items[i] = items[i + 1];
            }
            items[items.Length - 1] = temp;
        }
    }
}